<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>图像追踪</title>
  <script src="/js/aframe-master.min.js"></script>
  <!-- <script src="/js/aframe-ar-nft.js"></script> -->
  <!-- <script src="/js/gestures.js"></script> -->
  <script src="https://cdn.bootcss.com/eruda/1.5.8/eruda.min.js"></script>
  <script>
    eruda.init();
    console.log('控制台打印信息');
  </script>
  <style>
    /*加载过程中蒙罩的css*/
    .arjs-loader {
      height: 100%;
      width: 100%;
      position: absolute;
      top: 0;
      left: 0;
      background-color: rgba(0, 0, 0, 0.8);
      z-index: 9999;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .arjs-loader div {
      text-align: center;
      font-size: 1.25em;
      color: white;
    }
  </style>
</head>

<body style="margin : 0px; overflow: hidden;">
  <!-- a-entity animation-mixer gesture-handler="minScale: 0.25; maxScale: 10" -->
  <!-- cursor="rayOrigin: mouse" raycaster="objects: [foo]"-->
  <a-scene raycaster="objects: [foo]">
    <a-assets>
      <a-asset-item id="tree" src="model/mubiao/scene.gltf"></a-asset-item>
    </a-assets>
    <a-entity id="my-object" gltf-model="#tree" scale="5000 5000 5000" position="50 0 -200" rotation="-180 60 0" foo>
    </a-entity>
  </a-scene>

</body>

</html>


<script>
  AFRAME.registerComponent("foo", {
    schema: {
      enabled: { default: true },
      rotationFactor: { default: 5 },
      minScale: { default: 0.3 },
      maxScale: { default: 8 },
    },
    init: function () {
      this.el.sceneEl.addEventListener("click", (e) => {
        console.log("执行了-click");
      });
    },
  });
</script>